package com.example.backend.config;

import com.example.backend.filter.JWTFilter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;


/**
 * @Author Jcy
 * @Date 2022/5/2
 */


@Configuration
public class ShiroConfig implements WebMvcConfigurer {
    @Resource
    private JWTFilter jwtfilter;


    @Override
    public void addInterceptors(InterceptorRegistry registry)
    {
//        注册自己的拦截器并设置拦截的请求路径
          registry.addInterceptor(jwtfilter).addPathPatterns("/**")
                  .excludePathPatterns("/v1/users")
                  .excludePathPatterns("/v1/admin/**");
    }
}


